<?php
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_ucenter/model')->方法名();
*/
namespace jy_ucenter;
defined('BY_JYA') or exit('error');
class model extends \plugin{
	public function up_news($article=array(),$isgoods=false){
		$uc=$this->plugin_setting('basic');
		if(!$uc || !$uc['up_status'] || !$uc['db_host'] || !$uc['db_user'] || !$uc['db_passwd'] || !$uc['db_name'] || !$uc['db_charset'] || !$uc['bbs_pre'] || !$uc['up_cid'] || !$uc['up_name'] || !$uc['up_uid']){
			exi('UC参数配置有误，无法同步发帖。如需发帖，请前往参数设置！','error');
		}
		$bbs_db=array(
			'host'=>$uc['db_host'],
			'username'=>$uc['db_user'],
			'password'=>$uc['db_passwd'],
			'database'=>$uc['db_name'],
			'charset'=>$uc['db_charset'],
			'tablepre'=>$uc['bbs_pre'],
			'port'=>3306,
		);
		require ROOT_D.'/addons/jy_ucenter/class/bbs_release.php';
		$bbs_release=new bbs_release($bbs_db);
		$up_bbsid=$isgoods?$uc['up_gid']:$uc['up_cid'];
		$res=$bbs_release->post($uc['up_cid'], $article['title'], $article['content'], $uc['up_name'], $uc['up_uid'],0);
	}
}
?>